core: Add context when we fail to chmod()/chown()
authorColin Walters <walters@verbum.org>
Thu, 19 Jul 2012 15:01:39 +0000 (11:01 -0400)
committerColin Walters <walters@verbum.org>
Thu, 19 Jul 2012 15:01:39 +0000 (11:01 -0400)
This helps make things less confusing when we try to create a file not
owned by our uid, such as running ostree-pull as non-root on a
repository owned by root.

src/libostree/ostree-core.c

index 2d61b1854e899c2576e1b9762665435abdcfb58c..39a6531dc715abae9f0e68d7dcb36d33fdc98d42 100644 (file)
@@ -1145,6 +1145,7 @@ ostree_create_file_from_input (GFile            *dest_file,
       if (lchown (dest_path, uid, gid) < 0)
         {
           ot_util_set_error_from_errno (error, errno);
+          g_prefix_error (error, "lchown(%u, %u) failed: ", uid, gid);
           goto out;
         }
     }
@@ -1154,6 +1155,7 @@ ostree_create_file_from_input (GFile            *dest_file,
       if (chmod (dest_path, mode) < 0)
         {
           ot_util_set_error_from_errno (error, errno);
+          g_prefix_error (error, "chmod(%u) failed: ", mode);
           goto out;
         }
     }